﻿Imports DataAccess
Imports Entities
Public Class ClienteComercialBL
    Public Shared Function List() As List(Of clientescomerciales)
        Dim lista As New List(Of clientescomerciales)
        lista = ClienteComercialDAL.List
        Return lista
    End Function
    Public Shared Function save(ByVal zObject As clientescomerciales) As clientescomerciales
        If ClienteComercialDAL.Exist(zObject.CLIENTE) Then
            Return ClienteComercialDAL.Update(zObject)
        Else
            Return ClienteComercialDAL.Create(zObject)
        End If
    End Function
    Public Shared Function Delete(ByVal zId As Long) As Boolean
        Return ClienteComercialDAL.Delete(zId)
    End Function
    Public Shared Function SearchByRut(ByVal zRut As String) As clientescomerciales
        Return ClienteComercialDAL.SearchByRut(zRut)
    End Function
    Public Shared Function SearchById(ByVal zId As Long) As clientescomerciales
        Return ClienteComercialDAL.SearchById(zId)
    End Function
    Public Shared Function GetNombre(ByVal zId As Long) As String
        Dim obj As New clientescomerciales
        obj = ClienteComercialDAL.SearchById(zId)
        If Not IsNothing(obj) Then
            Return obj.RAZONSOCIAL
        Else
            Return ""
        End If
    End Function
End Class
